🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / service / src / androidMain / kotlin / org / meshtastic / core / service / ForegroundStartContext.kt
Displaying Raw • Download
core/service/src/androidMain/kotlin/org/meshtastic/core/service/ForegroundStartContext.kt fix/qr-error-correction (7b45f84f) Text, 1.57 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.service
Tff7b72import T7ee787android.app.ActivityManager
T8b949e/**
* Whether this process currently holds a user-visible component.
*
* Uses process importance rather than a lifecycle observer because importance is what ActivityManager itself consults
* when deciding whether a foreground-service start is permitted, and it is correct even in a process that was revived
* by a broadcast and has no activity at all.
*
* `IMPORTANCE_FOREGROUND` is the conservative choice: a false negative merely defers a service start to the next
* trigger, whereas a false positive produces the exception this check exists to avoid.
*/
Tff7b72internal Tff7b72fun Td2a8ffisAppInForegroundTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Boolean Tb4b4b4{
Tff7b72val Te6edf3state Tff7b72= Te6edf3ActivityManagerTb4b4b4.Te6edf3RunningAppProcessInfoTb4b4b4(Tb4b4b4)
Te6edf3ActivityManagerTb4b4b4.Te6edf3getMyMemoryStateTb4b4b4(Te6edf3stateTb4b4b4)
Tff7b72return Te6edf3stateTb4b4b4.Te6edf3importance Tff7b72<Tff7b72= Te6edf3ActivityManagerTb4b4b4.Te6edf3RunningAppProcessInfoTb4b4b4.Te6edf3IMPORTANCE_FOREGROUND
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s